import React from 'react'

import { Table, Button, Popconfirm } from 'antd'

const ProductList  = function({ onDelete, products }) {
    const columns = [{
        title: 'Name',
        dataIndex: 'name',
    }, {
        title: 'Actions',
        render: (text, record) => {
            return (
                <Popconfirm title="Delete?" onConfirm={() => onDelete(record.id)}>
                    <Button>Delete</Button>
                </Popconfirm>
            );
        },
    }];
    console.log(products)
    return (
        <Table
            dataSource={products}
            columns={columns} />
    )
}


export default ProductList